﻿using Furion.FriendlyException;
using Furion.Logging;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OAS.Core
{
    public class DatabaseLoggingWriter : IDatabaseLoggingWriter
    {
        private readonly ISqlSugarClient db;
        // 支持构造函数注入任何实例，会自动释放任何服务，比如注入 IRepository，或者 SqlSugarClient
        public DatabaseLoggingWriter(ISqlSugarClient db)
        {
            this.db = db;
        }

        public async Task WriteAsync(LogMessage logMsg, bool flush)   // Furion 4.9.1.58 之前为 public void Write(LogMessage logMsg, bool flush)
        {
            // 这里写你任何插入数据库的操作，无需 try catch
        }
    }
}
